﻿
'Author : Jawad Najim
'Date : 2/09/2012


Imports System.Data.SqlClient
Public Class StudentCourseRecord

    Private aStudentID As Integer
    Private aCourseList As List(Of Course)
    Private aAttempt As Integer
    Private aGrade As String

    Public Sub New()
        aStudentID = 0
        aCourseList = New List(Of Course)
        aAttempt = 0
        aGrade = ""
    End Sub

    Public Sub New(ByVal std As Integer, ByVal srecord As List(Of Course), ByVal attemptNum As Integer, ByVal grade As String)
        aStudentID = std
        aCourseList = srecord
        aAttempt = attemptNum
        aGrade = grade
    End Sub

    'This method is used when creating a student object : read a course from dataset/datatable and add it to student object's list of corses taken
    Public Sub AddCourse(ByVal acourse As Course)
        aCourseList.Add(acourse)
    End Sub

    Public Property StudentID() As Integer
        Get
            Return aStudentID
        End Get
        Set(value As Integer)
            aStudentID = value
        End Set
    End Property
    'We should not be able to delete a course/grade/attempts from student course record (Jawad)
    'The following properties should be read only 

    'This is the list of all courses taken by the student defiend with 'aStudentID'
    Public ReadOnly Property ListOfCoursesTaken() As List(Of Course)
        Get
            Return aCourseList
        End Get
    End Property

    Public ReadOnly Property Grade() As String
        Get
            Return aGrade
        End Get
    End Property

    Public ReadOnly Property Attempt() As Integer
        Get
            Return aAttempt
        End Get

    End Property

    
End Class
